﻿@using System.Text.RegularExpressions
@using Common
@using Masuit.Tools.Win32
@using Models.Entity
@model PostHistoryVersion[]
@{
    ViewBag.Title = Model[0].Title + "版本对比";
    Layout = "~/Views/Shared/_Layout.cshtml";
    string[] colors = { "success", "info", "primary", "warning", "danger", "default", "primary" };
}
<link href="~/Assets/UEditor/third-party/SyntaxHighlighter/styles/shCore.min.css" rel="stylesheet" />
<div class="container-fluid">
    <ol class="cd-breadcrumb triangle">
        <li>@Html.ActionLink("首页", "Index", "Home")</li>
        <li>@Html.ActionLink("文章列表", "Post", "Home")</li>
        <li>@Html.ActionLink(Model[0].Title, "Details", "Post", new { id = Model[0].Id }, null)</li>
        <li>@Html.ActionLink("历史版本", "History", "Post", new { id = Model[0].Id }, null)</li>
        <li class="current">
            <em>版本对比</em>
        </li>
    </ol>
    <div class="row">
        <div class="col-md-6">
            <div class="wrapper-content article">
                <div class="ibox">
                    <div class="ibox-content animated fadeIn">
                        <main>
                            <section>
                                <header class="page-header">
                                    <div class="text-center">
                                        <a>
                                            <h2 class="padding-bot10">
                                                @Model[1].Title
                                            </h2>
                                        </a>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-7">
                                            <div class="padding-bot10">
                                                修改于<span class="text-success">@Model[1].ModifyDate.ToString("yyyy-MM-dd HH:mm:ss")</span> | 原分类：<i class="icon-map-pin"></i>@Html.ActionLink(Model[1].Category.Name, "Category", "Home", new { id = Model[1].CategoryId }, new { @class = "label label-" + colors[new Random().StrictNext() % colors.Length] })
                                                @if (Model[1].Seminar.Any())
                                                {
                                                    <span> | 原所属专题：</span>
                                                    var seminars = Model[1].Seminar;
                                                    foreach (Seminar s in seminars)
                                                    {
                                                        @Html.ActionLink(s.Title, "Index", "Seminar", new { id = s.Id }, new { @class = "label label-" + colors[new Random().StrictNext() % colors.Length] })<text> </text>
                                                    }
                                                }
                                            </div>
                                        </div>
                                        @{
                                            if (!string.IsNullOrEmpty(Model[1].Label))
                                            {
                                                <div class="pull-right margin-right20">
                                                    <div>
                                                        @foreach (string s in Model[1].Label.Split(',', '，', ' '))
                                                        {
                                                            if (!string.IsNullOrEmpty(s))
                                                            {
                                                                <a href="/tag/@Server.UrlEncode(s)">
                                                                    <span class="label label-@colors[new Random().StrictNext() % colors.Length]">@s</span>
                                                                </a>
                                                            }
                                                        }
                                                    </div>
                                                </div>
                                            }
                                        }
                                    </div>
                                </header>
                                <article class="article" id="article">
                                    @MvcHtmlString.Create(Regex.Replace(Model[1].Content, @"<img\s+[^>]*\s*src\s*=\s*['""]?(\S+\.\w{3,4})['""]?[^/>]*/>", $"<img data-original=\"$1\" alt='{CommonHelper.GetSettings("Title")}' title='{CommonHelper.GetSettings("Title")}'/>"))
                                </article>
                            </section>
                        </main>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="wrapper-content article">
                <div class="ibox">
                    <div class="ibox-content animated fadeIn">
                        <main>
                            <section>
                                <header class="page-header">
                                    <div class="text-center">
                                        <a>
                                            <h2 class="padding-bot10">
                                                @Model[2].Title
                                            </h2>
                                        </a>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-7">
                                            <div class="padding-bot10">
                                                修改于<span class="text-success">@Model[2].ModifyDate.ToString("yyyy-MM-dd HH:mm:ss")</span> | 原分类：<i class="icon-map-pin"></i>@Html.ActionLink(Model[2].Category.Name, "Category", "Home", new { id = Model[2].CategoryId }, new { @class = "label label-" + colors[new Random().StrictNext() % colors.Length] })
                                                @if (Model[2].Seminar.Any())
                                                {
                                                    <span> | 原所属专题：</span>
                                                    var seminars = Model[2].Seminar;
                                                    foreach (Seminar s in seminars)
                                                    {
                                                        @Html.ActionLink(s.Title, "Index", "Seminar", new { id = s.Id }, new { @class = "label label-" + colors[new Random().StrictNext() % colors.Length] })<text> </text>
                                                    }
                                                }
                                            </div>
                                        </div>
                                        @{
                                            if (!string.IsNullOrEmpty(Model[2].Label))
                                            {
                                                <div class="pull-right margin-right20">
                                                    <div>
                                                        @foreach (string s in Model[2].Label.Split(',', '，', ' '))
                                                        {
                                                            if (!string.IsNullOrEmpty(s))
                                                            {
                                                                <a href="/tag/@Server.UrlEncode(s)">
                                                                    <span class="label label-@colors[new Random().StrictNext() % colors.Length]">@s</span>
                                                                </a>
                                                            }
                                                        }
                                                    </div>
                                                </div>
                                            }
                                        }
                                    </div>
                                </header>
                                <article class="article" id="article">
                                    @MvcHtmlString.Create(Regex.Replace(Model[2].Content, @"<img\s+[^>]*\s*src\s*=\s*['""]?(\S+\.\w{3,4})['""]?[^/>]*/>", $"<img data-original=\"$1\" alt='{CommonHelper.GetSettings("Title")}' title='{CommonHelper.GetSettings("Title")}'/>"))
                                </article>
                            </section>
                        </main>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="cyReward" role="cylabs" data-use="reward"></div>
    <!--PC和WAP自适应版-->
    <div id="SOHUCS" sid="cv-@Model[0].Id-@Model[1].Id"></div>
    <script type="text/javascript">
        (function () {
            var appid = 'cytsT3QgK';
            var conf = 'prod_0358240040a6c9611add9de991099d42';
            var width = window.innerWidth || document.documentElement.clientWidth;
            if (width < 960) {
                window.document.write(
                    '<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' +
                    appid + '&conf=' + conf + '"><\/script>');
            } else {
                var loadJs = function (d, a) {
                    var c = document.getElementsByTagName("head")[0] || document.head || document.documentElement;
                    var b = document.createElement("script");
                    b.setAttribute("type", "text/javascript");
                    b.setAttribute("charset", "UTF-8");
                    b.setAttribute("src", d);
                    if (typeof a === "function") {
                        if (window.attachEvent) {
                            b.onreadystatechange = function () {
                                var e = b.readyState;
                                if (e === "loaded" || e === "complete") {
                                    b.onreadystatechange = null;
                                    a()
                                }
                            }
                        } else {
                            b.onload = a
                        }
                    }
                    c.appendChild(b)
                };
                loadJs("https://changyan.sohu.com/upload/changyan.js", function () {
                    window.changyan.api.config({
                        appid: appid,
                        conf: conf
                    })
                });
            }
        })();
    </script>
</div>
<script src="~/Assets/UEditor/third-party/SyntaxHighlighter/scripts/shCore.min.js"></script>
<script src="~/Assets/UEditor/third-party/SyntaxHighlighter/scripts/bundle.min.js"></script>
<script>
    $(function() {
	    SyntaxHighlighter.all();
	    SyntaxHighlighter.defaults['toolbar'] = false;
	})
</script>